package io.xxx.omni.mdc.site.web

import io.xxx.omni.mdc.model.Authorization
import io.xxx.omni.mdc.site.service.AuthorizationService
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.web.bind.annotation.*

@RestController
@RequestMapping("/authorizations")
class AuthorizationController {

    @Autowired
    private lateinit var authorizationService: AuthorizationService

    @GetMapping
    fun getAll(@RequestParam pid: String?, @RequestParam enabled: Boolean?): List<Authorization> {
        return authorizationService.getAll(pid, enabled)
    }

    @GetMapping("/{id}")
    fun getOne(@PathVariable id: String): Authorization? {
        return authorizationService.getOne(id)
    }
}